﻿using Volo.Abp.Domain.Entities.Auditing;

namespace FlyingEye.DeviceMaintenance
{
    /// <summary>
    /// 设备保养记录
    /// </summary>
    public class MaintenanceRecordModel : AuditedEntity<Guid>
    {
#pragma warning disable CS8618 // 在退出构造函数时，不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
        private MaintenanceRecordModel()
#pragma warning restore CS8618 // 在退出构造函数时，不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
        {
            CreationTime = DateTime.UtcNow;
        }

        public MaintenanceRecordModel(
            Guid id,
            Guid devicePartId,
            string maintenanceStep,
            bool isActive,
            string? cancellationReason) : base(id)
        {
            DevicePartId = devicePartId;
            MaintenanceStep = maintenanceStep;
            IsActive = isActive;
            CancellationReason = cancellationReason;
        }

        /// <summary>
        /// 保养部件 ID
        /// </summary>
        public Guid DevicePartId { get; set; }

        /// <summary>
        /// 保养步骤
        /// <see cref="Consts.MaintenanceStep"/>
        /// </summary>
        public string MaintenanceStep { get; set; }

        /// <summary>
        /// 记录是否是激活状态
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 终止原因
        /// </summary>
        public string? CancellationReason { get; set; }
    }
}
